$(function () {
    var chart;
    
    var date = new Date();
    
    var getTime = function() {
        return date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
    }
    
    var getDate = function() {
        return  date.getDate() + '-' + (date.getMonth() + 1) + '-' + date.getFullYear();
    }
    
    $(document).ready(function() {
	
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'spline'
            },
            title: {
                text: 'Learning Rate'
            },
            xAxis: {
				title: {
                    text: 'Epoch'
                },
                type: 'int',
                tickInterval: 10
            },
            yAxis: {
                title: {
                    text: 'Error'
                },
                min: 0,
                gridLineWidth: 0,
                alternateGridColor: null,
                plotBands: []
            },
            tooltip: {
                formatter: function() {
                    return 'Error: ' + this.y + '<br/>Epoch: ' + this.x*50;
                }
            },
            plotOptions: {
                spline: {
                    lineWidth: 4,
                    states: {
                        hover: {
                            lineWidth: 5
                        }
                    },
                    marker: {
                        enabled: false,
                        states: {
                            hover: {
                                enabled: true,
                                symbol: 'circle',
                                radius: 5,
                                lineWidth: 1
                            }
                        }
                    }
                }
            },
            series: [{
                //name: 'Last Generated on: ' + getDate() + ' at ' + getTime(),
				name: 'Absolute Error',
                data: absoluteErrors
    
            }]
        });
    });
   
    var html =  '';
    //html += '<tr><td class="right">Training Set: </td><td class="left">' + trainingSet['success'] +'/' + trainingSet['total'] + '</td></tr>';
	html += '<tr><td class="right">Hits: ' + good +'</td><td class="left">Misses: '+ bad +'</td></tr>';
    html += 'Last Generated on: ' + getDate() + ' at ' + getTime(),
    $('#statistics2').html(html);
   
});